//
//  UIBarButtonItem+Extensions.swift
//  WCKweibo
//
//  Created by wukai on 17/2/26.
//  Copyright © 2017年 wuchunkai. All rights reserved.
//

import Foundation

extension UIBarButtonItem{

    convenience init(title: String, fontSize: CGFloat = 16, target: AnyObject?, action: Selector, isBack: Bool = false) {
        
        let btn: UIButton = UIButton.cz_textButton(title, fontSize: fontSize, normalColor: UIColor.darkGray, highlightedColor: UIColor.orange)
        
        if isBack {
            let imageName = "navigationbar_back_withtext"
            
            btn.setImage(UIImage(named: imageName), for: UIControlState(rawValue: 0))
             btn.setImage(UIImage(named: imageName + "_highlighted"), for: .highlighted)
            
            btn.sizeToFit()
            
        }
        
        //self.init实例化 uibarbuttonItem
        self.init(customView: btn)
        
    }

}


